import { HttpClient } from "@angular/common/http";
import { Component } from "@angular/core";

@Component({
  selector: "app-tab1",
  templateUrl: "tab1.page.html",
  styleUrls: ["tab1.page.scss"],
})
export class Tab1Page {
  res: Result;
  books: Books;
  constructor(public http: HttpClient) {}

  ngOnInit() {
    window.localStorage.getItem("uname");
    let url = "http://xiaoshuogebed.applinzi.com/banner";
    this.http.get(url).subscribe((res: Result) => {
      this.res = res;
    });
    let bookUrl = "http://xiaoshuogebed.applinzi.com/books";
    this.http.get(bookUrl).subscribe((res: Books) => {
      this.books = res;
    });
  }
}
interface Result {
  code: number;
  message: string;
  results: result[];
}
interface Books {
  code: number;
  message: string;
  results: Book[];
}
interface result {
  nid: number;
  img: string;
  shortIntro: string;
  title: string;
}
interface Book {
  author: string;
  bid: number;
  cover: string;
  latelyFollower: string;
  majorCate: string;
  male_id: number;
  minorCate: string;
  shortIntro: string;
  title: string;
}
